package com.nlp.visualization.service.impl.backend;

import com.nlp.visualization.dao.backend.ITManagerInfoDao;
import com.nlp.visualization.pojo.db.TManagerInfo;
import com.nlp.visualization.service.backEnd.IManagerInfoService;
import com.nlp.visualization.service.base.ServiceSupportImpl;
import com.nlp.visualization.utils.MD5Util;
import org.apache.commons.collections.map.HashedMap;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Map;

/**
 * @author LXM
 * @Title: NLPVisualizationTools
 * @Description:
 * @date 2018/5/10下午9:37
 */
@Service
public class ManagerInfoServiceImpl extends ServiceSupportImpl<TManagerInfo> implements IManagerInfoService {

    Logger logger = LoggerFactory.getLogger(ManagerInfoServiceImpl.class);

    @Autowired
    private ITManagerInfoDao managerInfoDao;

    /**
     * 检查用户名和密码是否正确
     *
     * @param name
     * @param password
     * @return
     */
    @Override
    public boolean checkManagerInfo(String name, String password) {
        Map fieldMap = new HashedMap();
        TManagerInfo managerInfo = managerInfoDao.findByField(fieldMap);
        if ((managerInfo.getPassword()).equals(MD5Util.MD5(password))) {
            return true;
        }

        return false;
    }
}
